package sys

import (
	"github.com/gofiber/fiber/v2"
	"go-web2/app/common/config"
	"go-web2/app/model/sys"
	"time"
)

type LogController struct{}

// 日志列表分页
func (LogController) GetPage(c *fiber.Ctx) error {
	syslog := sys.SysLog{}
	syslog.IP = c.Query("code")
	name := c.Query("name")
	createTime, _ := time.Parse("2006-01-02", c.Query("startDate"))
	syslog.CreatorId = &name
	syslog.CreateTime = createTime
	pageSize := c.QueryInt("pageSize", 10)
	pageNum := c.QueryInt("pageNum", 1)
	return c.Status(200).JSON(config.Success(syslog.GetPage(pageSize, pageNum)))
}
